﻿@namespace Masa.Blazor
@inherits MSheet

@base.BuildRenderTree

@code {

    protected override RenderFragment GenBody() => __builder =>
    {
        @GenProgress()
        @GenTitle()
        @GenSubtitle()
        @GenText()
    };

    private RenderFragment GenProgress() => __builder =>
    {
        var progress = RenderFragments.GenProgress(this);
        if (progress is null)
        {
            return;
        }

        <div class="@_block.Element("progress")">
            @progress
        </div>
    };

    private RenderFragment GenTitle() => __builder =>
    {
        @if (!string.IsNullOrEmpty(Title))
        {
            <MCardTitle>@Title</MCardTitle>
        }
    };

    private RenderFragment GenSubtitle() => __builder =>
    {
        @if (!string.IsNullOrEmpty(Subtitle))
        {
            <MCardSubtitle>@Subtitle</MCardSubtitle>
        }
    };

    private RenderFragment GenText() => __builder =>
    {
        if (!string.IsNullOrEmpty(Text))
        {
            <MCardText>@Text</MCardText>
        }
        else
        {
            @ChildContent
        }
    };

}